package com.example.volunteer.service;


import com.example.volunteer.exception.SmsSendException;

import java.util.List;

public interface SmsSender {


    void sendSms(String phoneNumber, String message) throws SmsSendException;


    default int sendBatchSms(List<String> phoneNumbers, String message) throws SmsSendException {
        int successCount = 0;
        for (String phone : phoneNumbers) {
            try {
                sendSms(phone, message);
                successCount++;
            } catch (SmsSendException e) {
                // 记录失败日志，继续发送下一个
            }
        }
        return successCount;
    }
}
